package com.example.demo.service.impl;


import com.example.demo.model.employee;
import com.example.demo.repository.employeeRepository;
import com.example.demo.service.employeeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.List;
@Transactional
@Service
public class employeeServiceImpl implements employeeService {

    @Resource
    private employeeRepository employRepository;

    @Override
    public employee findById(String id) {
        return employRepository.findById(id).get();
    }

    @Override
    public List<employee> findAll() {
        return employRepository.findAll();
    }

    @Override
    public void delete(String id) {
        employRepository.deleteById(id);
    }

    @Override
    public employee save(employee employ) {
        return employRepository.save(employ);
    }
    @Override
    public void deleteAllByEnameIsNull()
    {
        employRepository.deleteAllByEnameIsNull();
    }

}
